<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="StyleSheet" href="../css/style.css"/>
<script src="../js/jquery-1.4.2.min.js"></script>
<script src="../js/jquery-plus-juqery-ui.ui.js"></script>
<script src="../js/jquery-ui-1.8.2.custom.min.js"></script>
<script src="../js/public.js"></script>
</head>
<body>
<p class="pt">冒烟测试</p>
	<div id="eurl">
		<form action="smokemain.php" method="post">
		<!--textarea name="columnId" cols="8" rows="1"></textarea-->
		<span>请选择需要冒烟的机器行</span>
		<!-input size="10" type="button" value="按钮"->
		<select name="columnId">
                        <option>
	        	<option>fe.staging.kgb.cnz.alimama.com
	        	<option>fer1a
			<option>fer2a
                        <option>fer3a 
                        <option>fer4a 
                        <option>fer5a 
	       </select>
               <span>请选择需要冒烟的机器</span>
               <select name="mechine">
                   <option>
                   <option>1
                   <option>2
                   <option>3
                   <option>4
                   <option>5
                   <option>6
                   <option>7
                   <option>8
                   <option>9
                   <option>10
                   <option>11
               </select>
               <span>请选择需要冒烟的功能点</span>
               <select name= "smokeItem">
                    <option> 
                    <option>CP 
                    <option>RANKSCORE 
                    <option>EURL 
                    <option>TBGOODSLINK 
               </select> 
	       <input type="submit" value="执行 ">
	       </form>
	       <br>
		
		<table width=80% >
		<tr class="tl" ><th width=20% >接口</th><th width=30% >验证点</th><th width=20% >执行结果</th><th width=30% >机器名</th></tr>
<?php
    require_once("function.php");
    $inputs = file("urls");
    $columnId =filter_input(INPUT_POST,"columnId");
    $mechine = filter_input(INPUT_POST,"mechine");
    $smokeItem = filter_input(INPUT_POST,"smokeItem");
    if($columnId == "")
    {
        ?><script>alert("请选择待冒烟的机器行staging|1|2|3|4|5");</script><?PHP
          return false;
    }
    if($columnId == "fe.staging.kgb.cnz.alimama.com")
    { 
        foreach($inputs as $input)
        {
            $HOSTNAME = $columnId;
            $url = "http://".$HOSTNAME."/".$input;
            $querys=parse_url($url);
            parse_str($querys['query'],$parms);
            if((isset($parms["from"]))&&($parms["from"]!="")&&(!isset($parms['ip']))||($parms['ip']=="")) {$tag = 1;}
            else {$tag = 0;}
            if(isset($parms['name'])&&($parms['name'] == "tbuad")||($parms['name'] == "tbtpd"))
            {
                $prodType = 6;
                $interface = $parms['name'];
            }
            else if(!isset($parms['name'])){$prodType=6;$interface = 'tbuad';}
            else $prodType = 7;
            if(isset($parms['name'])&&($parms['name']=='dpad')){$subProdType = 6;}
            else $subProdType = ""; 
            if(isset($parms['refpid'])){$refpid = $parms['refpid'];}
            else {$refpid="";}
            if(isset($parms['creativeid'])){$creativeId = $parms['creativeid'];}
            else {$creativeId="";}
            if(isset($parms['sbid'])){$sbid = $parms['sbid'];}
            else {$sbid="";}
            if(isset($parms['offset'])&&($parms['offset']!= ""))
            {$turnOffset = $parms['offset'];}
            else {$turnOffset = 0;}
            $resArr = sendQuery($url);
            $showMode = getShowMode($url);
            $interface = getInterface($url);
            if($showMode == "x"){$resArr = changexml2Arr($resArr);}
            if($showMode == "j"){$resArr = getJson($str,$interface,$p4pname);}
            if($smokeItem == "")
            {
                $resCp = judgecp($resArr,$showMode);
                $resRankscore = judgerankscore($resArr,$interface);
                $resEurl = judgeNewEurl($resArr,$prodType,$refpid,$creativeId,$sbid,$tag,$subProdType);
                $resGoodsLink = judgeimgurl($resArr);
                echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
                if($resCp == 1)
                {
                    echo ("<td><b>1.[{$interface}]</b></td><td>CP</td><td>success</td><td>{$HOSTNAME}</td></tr>");
                }
                else
                {
                    echo("<tr bgcolor='red'>");
                    echo ("<td><b>1.[{$interface}]</b></td><td>CP</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
                }
                echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
                if($resRankscore == 1)
                {
                    echo ("<td><b>2.[{$interface}]</b></td><td>RankScore</td><td>success</td><td>{$HOSTNAME}</td></tr>");
                }
                else
                {
                    echo("<tr bgcolor='red'>");
                    echo ("<td><b>2.[{$interface}]</b></td><td>RankScore</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
                }
                echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
                if($resEurl == 1)
                {
                    echo ("<td><b>2.[{$interface}]</b></td><td>Eurl</td><td>success</td><td>{$HOSTNAME}</td></tr>");
                }
                else 
                {
                    echo("<tr bgcolor='red'>");
                    echo ("<td><b>2.[{$interface}]</b></td><td>RankScore</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
                }
                echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
                if($resGoodsLink == 1)
                {
                    echo ("<td><b>2.[{$interface}]</b></td><td>TBGoodsLink</td><td>success</td><td>{$HOSTNAME}</td></tr>");
                }
                else 
                {
                    echo("<tr bgcolor='red'>");
                    echo ("<td><b>2.[{$interface}]</b></td><td>TBGoodsLink</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");   
                }
                 
            }
            if($smokeItem == "CP")
            {
                $resCp = judgecp($resArr,$showMode);
                echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
                if($resCp == 1)
                {
                    echo ("<td>1.[{$interface}]</td><td>CP</td><td>success</td><td>{$HOSTNAME}</td></tr>");
                }
                else{
                echo("<tr bgcolor='red'>");echo ("<td>1.[{$interface}]</td><td>CP</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
                }
            }
            if($smokeItem == "RANKSCORE")
            {
                $resRankscore = judgerankscore($resArr,$interface);
                echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
                if($resRankscore == 1)
                {
                    echo ("<td>2.[{$interface}]:RANKSCORE</td><td>success</td><td>{$HOSTNAME}</td></tr>");
                }
                else {
                echo("<tr bgcolor='red'>");echo ("<td>2.[{$interface}]:RANKSCORE</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
                }
            } 
            if($smokeItem == "EURL")
            {
                $resEurl = judgeNewEurl($resArr,$prodType,$refpid,$creativeId,$sbid,$tag,$subProdType);
                echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
                if($resEurl == 1)
                {
                    echo ("<td>3.[{$interface}]</td><td>EURL</td><td>success</td><td>{$HOSTNAME}</td></tr>");
                }
                else{
                    echo("<tr bgcolor='red'>");echo ("<td>3.[{$interface}]</td><td>EURL</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
                }
               
            }
            if($smokeItem == "TBGOODSLINK")
            {
                $resGoodsLink = judgeimgurl($resArr);
                echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseouthis.style.background='white'\">");
                if($resGoodsLink == 1)
                {
                    echo ("<td>3.[{$interface}]</td><td>TBGOODSLINK</td><td>success</td><td>{$HOSTNAME}</td></tr>");
                } 
                else
                {
                    echo("<tr bgcolor='red'>");echo ("<td>3.[{$interface}]</td><td>TBGOODSLINK</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
                } 
            }
        }
    }
    else
    {   
        switch($columnId)
        {
            case "fer1a":$HOSTHEAD="fer1a";break;
            case "fer2a":$HOSTHEAD="fer2a";break;
            case "fer3a":$HOSTHEAD="fer3a";break;
            case "fer4a":$HOSTHEAD="fer4a";break;
            case "fer5a":$HOSTHEAD="fer5a";break;
        }
       foreach($inputs as $input)
       {
           if($mechine == "")
           {
               for($i = 1;$i<8;$i++)
               {
                   $HOSTNAME = $HOSTHEAD.$i.".kgb.cnz.alimama.com";
                   $url = "http://".$HOSTNAME."/".$input;
                   $querys=parse_url($url);
                   parse_str($querys['query'],$parms);
                   if((isset($parms["from"]))&&($parms["from"]!="")&&(!isset($parms['ip']))||($parms['ip']=="")) {$tag = 1;}
                   else {$tag = 0;}
                   if(isset($parms['name'])&&($parms['name'] == "tbuad")||($parms['name']== "tbtpd"))
                   {$prodType = 6;$interface = $parms['name'];}
                   else if(!isset($parms['name'])){$prodType=6;$interface = 'tbuad';}
                   else $prodType = 7;
                   if(isset($parms['name'])&&($parms['name']=='dpad')){$subProdType = 6;}
                   else $subProdType = "";
                   if(isset($parms['refpid'])){$refpid = $parms['refpid'];}
                   else {$refpid="";}
                   if(isset($parms['creativeid'])){$creativeId = $parms['creativeid'];}
                   else {$creativeId="";}
                   if(isset($parms['sbid'])){$sbid = $parms['sbid'];}
                   else {$sbid="";}
                   if(isset($parms['offset'])&&($parms['offset']!= ""))
                   {$turnOffset = $parms['offset'];}
                   else {$turnOffset = 0;}
                   $resArr = sendQuery($url);
                   $showMode = getShowMode($url);
                   $interface = getInterface($url);
                   if($showMode == "x"){$resArr = changexml2Arr($resArr);}
                   if($showMode == "j"){$resArr = getJson($str,$interface,$p4pname);}
                   if($smokeItem == "")
                   {
                       $resCp = judgecp($resArr,$showMode);
                       $resRankscore = judgerankscore($resArr,$interface); 
                       $resEurl = judgeNewEurl($resArr,$prodType,$refpid,$creativeId,$sbid,$tag,$subProdType);
                       $resGoodsLink = judgeimgurl($resArr);
                       echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">"); 
                       if($resCp == 1)
                       {
                           echo ("<td><b>1.[{$interface}]</b></td><td>CP</td><td>success</td><td>{$HOSTNAME}</td></tr>");
                       } 
                       else
                       {
                           echo("<tr bgcolor='red'>");
                           echo ("<td><b>1.[{$interface}]</b></td><td>CP</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
                       }
                       echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
                       if($resRankscore == 1)
                       {
                           echo ("<td><b>2.[{$interface}]</b></td><td>RankScore</td><td>success</td><td>{$HOSTNAME}</td></tr>");
                       }
                       else
                       {
                           echo("<tr bgcolor='red'>");
                           echo ("<td><b>2.[{$interface}]</b></td><td>RankScore</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
                       }
                       echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
                       if($resEurl ==1)
                       {
                           echo ("<td><b>3.[{$interface}]</b></td><td>Eurl</td><td>success</td><td>{$HOSTNAME}</td></tr>");
                       } 
                       else
                       {
                          echo("<tr bgcolor='red'>");
                          echo ("<td><b>3.[{$interface}]</b></td><td>Eurl</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
                       }
                       echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
                       if($resGoodsLink==1)
                       {
                           echo ("<td><b>4.[{$interface}]</b>:TBGoodsLink</td><td>success</td><td>{$HOSTNAME}</td></tr>");
                       } 
                       else
                       {
                           echo("<tr bgcolor='red'>");
                           echo ("<td><b>4.[{$interface}]</b>:TBGoodsLink</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
                       }
                       echo("<tr bgcolor='blue'>");
                   }
                   else
                   {
                       if($smokeItem == "CP")
                       {
                           $resCp = judgecp($resArr,$showMode);
                           echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">"); 
                           if($resCp == 1)  
                           {
                               echo ("<td><b>1.[{$interface}]</b></td><td>CP</td><td>success</td><td>{$HOSTNAME}</td></tr>");
                           }
                           else
                           {
                               echo("<tr bgcolor='red'>");
                               echo ("<td><b>1.[{$interface}]</b></td><td>CP</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
                           } 
                      }
                       if($smokeItem == "RANKSCORE")
                       {
                           $resRankscore = judgerankscore($resArr,$interface);
                           echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
                           if($resRankscore ==1)
                           {
                               echo ("<td><b>2.[{$interface}]</b>:Rankscore</td><td>success</td><td>{$HOSTNAME}</td></tr>");
                           }
                           else
                           {
                               echo("<tr bgcolor='red'>");
                               echo ("<td><b>2.[{$interface}]</b></td><td>RankScore</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
                           }
                       }
                       if($smokeItem == "EURL")
                       {
                           $resEurl = judgeNewEurl($resArr,$prodType,$refpid,$creativeId,$sbid,$tag,$subProdType);
                           echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
                           if($resEurl == 1)
                           {
                               echo ("<td><b>3.[{$interface}]</b></td><td>Eurl</td><td>success/td><td>{$HOSTNAME}</td></tr>");
                           } 
                           else
                           {
                               echo("<tr bgcolor='red'>");
                               echo ("<td><b>3.[{$interface}]</b></td><td>Eurl</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>"); 
                           }  
                       }
                       if($smokeItem == "TBGOODSLINK")
                       {
                           $resGoodsLink = judgeimgurl($resArr);
                           echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
                           if($resGoodsLink == 1)
                           {
                               echo ("<td><b>4.[{$interface}]</b>:TBGoodsLink</td><td>success/td><td>{$HOSTNAME}</td></tr>"); 
                           }
                           else
                           {
                               echo("<tr bgcolor='red'>");
                               echo ("<td><b>4.[{$interface}]</b>:TBGoodsLink</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");   
                           }
                       }
                   }echo("<tr bgcolor='blue'>");
               }
           }
           else
           {
               $HOSTNAME = $HOSTHEAD.$mechine.".kgb.cnz.alimama.com";
               $url = "http://".$HOSTNAME."/".$input;
               $querys=parse_url($url);
               parse_str($querys['query'],$parms);
               if((isset($parms["from"]))&&($parms["from"]!="")&&(!isset($parms['ip']))||($parms['ip']=="")) {$tag = 1;}
               else {$tag = 0;}
               if(isset($parms['name'])&&($parms['name'] == "tbuad")||($parms['name']== "tbtpd"))
               {
                   $prodType = 6;$interface = $parms['name'];
               }
               else if(!isset($parms['name'])){$prodType=6;$interface = 'tbuad';}
               else $prodType = 7;
               if(isset($parms['name'])&&($parms['name']=='dpad')){$subProdType = 6;}
               else $subProdType = "";
               if(isset($parms['refpid'])){$refpid = $parms['refpid'];}
               else {$refpid="";}
               if(isset($parms['creativeid'])){$creativeId = $parms['creativeid'];}
               else {$creativeId="";}
               if(isset($parms['sbid'])){$sbid = $parms['sbid'];}
               else {$sbid="";}
               if(isset($parms['offset'])&&($parms['offset']!= ""))
               {$turnOffset = $parms['offset'];}
               else {$turnOffset = 0;}
               $resArr = sendQuery($url);
               $showMode = getShowMode($url);
               $interface = getInterface($url);
               if($showMode == "x"){$resArr = changexml2Arr($resArr);}
               if($showMode == "j"){$resArr = getJson($str,$interface,$p4pname);}
               if($smokeItem == "")
               {
                   $resCp = judgecp($resArr,$showMode);
                   $resRankscore = judgerankscore($resArr,$interface);
                   $resEurl = judgeNewEurl($resArr,$prodType,$refpid,$creativeId,$sbid,$tag,$subProdType);
                   $resGoodsLink = judgeimgurl($resArr); 
                   echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
                   if($resCp == 1)
                   {
                       echo ("<td><b>1.[{$interface}]</b></td><td>CP</td><td>success</td><td>{$HOSTNAME}</td></tr>");
                   }
                   else
                   {
	               echo("<tr bgcolor='red'");
        	       echo ("<td><b>1.[{$interface}]</b></td><td>CP</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
	            }
                   echo("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
                   if($resRankscore == 1)
                   {
                       echo ("<td><b>2.[{$interface}]</b></td><td>RankScore</td><td>success</td><td>{$HOSTNAME}</td></tr>");
                   }
                   else
                   {
                       echo("<tr bgcolor='red'>");
                       echo ("<td><b>2.[{$interface}]</b></td><td>RankScore</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</tad></tr>");
                    }
                    echo("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
                   if($resEurl == 1)
                   {
	               echo ("<td><b>3.[{$interface}]</b></td><td>Eurl</td><td>success</td><td>{$HOSTNAME}</td></tr>");
                   } 
                   else
                   {
	               echo("<tr bgcolor='red'>");
             	   echo ("<td><b>3.[{$interface}]</b></td><td>Eurl</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
                   }
                   echo("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
                   if($resGoodsLink == 1)
                   {
                       echo ("<td><b>4.[{$interface}]</b></td><td>GoodsLink</td><td>success</td><td>{$HOSTNAME}</td></tr>");
                   } 
                   else
                   {
	               echo("<tr bgcolor='red'>");
                       echo ("<td><b>4.[{$interface}]</b></td><td>GoodsLink</td><td>failed</td><td>{$HOSTNAME}</td></tr>");
                   }
               }
               echo("<tr bgcolor='blue'>");
               if($smokeItem == "CP")
               {
      	           $resCp = judgecp($resArr,$showMode);
                   echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
                   if($resCp == 1)
    	           {
    	               echo ("<td><b>1.[{$interface}]</b></td><td>CP</td><td>success</td><td>{$HOSTNAME}</td></tr>");
    	           }
                   else
                   {
	               echo("<tr bgcolor='red'>");echo ("<td>1.[{$interface}]</td><td>CP</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
	           }
                   echo("<tr bgcolor='blue'>");
               } 
               if($smokeItem == "RANKSCORE")
               {
                   $resRankscore = judgerankscore($resArr,$interface);
                   echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
	           if($resRankscore == 1)
	           {
	               echo ("<td><b>2.[{$interface}]</b></td><td>RankScore</td><td>success</td><td>{$HOSTNAME}</td></tr>");
	           }
	           else 
	           {
	               echo("<tr bgcolor='red'>");echo ("<td>2.[{$interface}]</td><td>RankScore</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
 	           }
                   echo("<tr bgcolor='blue'>");
                }
                if($smokeItem == "EURL")
                {
	            $resEurl = judgeNewEurl($resArr,$prodType,$refpid,$creativeid,$sbid,$tag,$subProdType);
                    echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
	            if($resEurl == 1)
	            {
	                echo ("<td><b>3.[{$interface}]</b></td><td>EURL</td><td>success</td><td>{$HOSTNAME}</td></tr>");
	            }
                    else
                    {
	                echo("<tr bgcolor='red'>");
                        echo ("<td><b>3.[{$interface}]</b></td><td>EURL</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
	            }
                    echo("<tr bgcolor='blue'>");
                }
                if($smokeItem == "TBGOODSLINK")
                {
	            $resGoodsLink = judgeimgurl($resArr);
                    echo ("<tr bgcolor='white' onmouseover=\"this.style.background='yellow'\" onmouseout=\"this.style.background='white'\">");
	            if($resGoodsLink == 1)
	            {
	                echo ("<td><b>4.[{$interface}]</b></td><td>TBGOODSLINK</td><td>success</td><td>{$HOSTNAME}</td></tr>");
	             }
	            else
	            {
	                echo("<tr bgcolor='red'>");echo ("<td>3.[{$interface}]</td><td>TBGOODSLINK</td><td>failed</td><td>{$HOSTNAME}:<br>{$url}</td></tr>");
                     }
                     echo("<tr bgcolor='blue'>");
                 }
            }
        }
    }
?>

	</table>
    </div>
</body>
</html>
